window.onload=function(){
    //设置默认焦点事件
    document.getElementById('lname-focus3').focus();
}
function setStyle(x){
    document.getElementById(x).style.background="#eeeeee";
    document.getElementById(x).style.borderLeft="5px solid #666";
}
function loss(y){
    document.getElementById(y).style.background="#fafafa";
    document.getElementById(y).style.border="none";
}



var itemHeight = 40;

function openMenu(obj) {
    menu = document.getElementById('menu1');
    indicator = document.getElementById('indicator1');
    height = menu.style.height;

    if (height == "0px" || height == "") {
        childAmount = menu.getElementsByTagName('div').length;
        height = childAmount * itemHeight;
        menu.style.height = height + "px";
        indicator.style.transform = "rotate(-90deg)";
    } else {
        menu.style.height = "0px";
        indicator.style.transform = "rotate(0deg)";
    }
}


/*********************删除话题操作***********************/
function Delete(url){
    if(confirm("确定删除吗?")){
        window.document.location.href=url;
    }
}
/*************************************************************/
//显示回复窗口：
function replyBtn(obj){
    //获得点击事件的父元素id:
    var parent=obj.parentNode.parentNode.parentNode;
    //将所有回复框关闭：
    var forms=document.getElementsByClassName("layui-reply-form");
    for(var i=0;i<forms.length;i++){
        forms[i].style.display="none";
    }
    //只显示当前点击下的回复框：
    var formNode=parent.nextElementSibling;
    formNode.style.display="block";

}
//回复取消按钮
function recover(){
    var forms=document.getElementsByClassName("layui-reply-form");
    for(var i=0;i<forms.length;i++){
        forms[i].style.display="none";
    }
}